package cn.wgx.common.security.feign.module.sysuser;


import cn.wgx.common.entity.sys.SysUser;
import cn.wgx.common.security.client.config.entity.LoginAppUser;
import cn.wgx.common.security.feign.config.FeignExceptionConfig;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(contextId = "userFeign", value="module-sys"
        , configuration = FeignExceptionConfig.class
       , fallbackFactory = UserFeignClientFallbackFactory.class
//       , decode404 = true
)
public interface SysUserFeign {


    /**
     * feign rpc访问远程/users-anon/login接口
     * @param username
     * @return
     */
    @GetMapping(value = "/api-sys/api/sysUser/anon/getCurrentUser", params = "username")
    LoginAppUser findCurrentUser(@RequestParam("username") String username);

    @GetMapping(value = "/api-sys/api/sysUser/anon/getByUsername", params = "username")
    LoginAppUser findByUsername(@RequestParam("username") String username);

    @GetMapping(value = "/api-sys/api/sysUser/anon/getByMobile", params = "mobile")
    LoginAppUser findByMobile(@RequestParam("mobile") String mobile);

    @GetMapping(value = "/api-sys/api/sysUser/anon/getUsersByIds", params = "id")
    List<SysUser> findUsersByUserIds(@RequestParam("id") List<Integer> id);

}
